.class public Lcom/teewoo/app/bus/util/geocoding/GeoCoding;
.super Ljava/lang/Object;
.source "GeoCoding.java"


# static fields
.field public static final GEO_CODING_API:Ljava/lang/String; = "http://ditu.google.com/maps/geo?"

.field public static final GEO_PARAM_HL:Ljava/lang/String; = "&hl=zh-CN"

.field public static final GEO_PARAM_KEY:Ljava/lang/String; = "&key="

.field public static final GEO_PARAM_OE:Ljava/lang/String; = "&oe=utf8"

.field public static final GEO_PARAM_OUTPUT:Ljava/lang/String; = "&output=xml"

.field public static final GEO_PARAM_Q:Ljava/lang/String; = "q="

.field public static final GEO_PARAM_SENSOR:Ljava/lang/String; = "&sensor=true"

.field public static final STATIC_MAP_KEY:Ljava/lang/String; = "ABQIAAAAdsBVZzDdGWjGTv_i6xi2lBSqwauxr2-99EJe1WoibE7PH44ybxSxb37RQERqDgfV1tED11pngApEJQ"


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 17
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static getAddressFromLocation(DD)Lcom/teewoo/app/bus/model/geocoding/CityAddress;
    .locals 6
    .parameter "latitude"
    .parameter "longitude"

    .prologue
    .line 33
    invoke-static {p0, p1, p2, p3}, Lcom/teewoo/app/bus/util/geocoding/GeoCoding;->getCodingURL(DD)Ljava/lang/String;

    move-result-object v3

    .line 34
    .local v3, url:Ljava/lang/String;
    new-instance v0, Lcom/teewoo/app/bus/model/geocoding/CityAddress;

    invoke-direct {v0}, Lcom/teewoo/app/bus/model/geocoding/CityAddress;-><init>()V

    .line 36
    .local v0, address:Lcom/teewoo/app/bus/model/geocoding/CityAddress;
    :try_start_0
    const-string v4, "UTF-8"

    invoke-static {v3, v4}, Lcom/teewoo/app/bus/util/WebUtils;->getWebWithoutAuth(Ljava/lang/String;Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v2

    .line 37
    .local v2, inputStream:Ljava/io/InputStream;
    if-eqz v2, :cond_0

    .line 38
    invoke-static {v2}, Lcom/teewoo/app/bus/util/geocoding/XMLParse;->getAddress(Ljava/io/InputStream;)Lcom/teewoo/app/bus/model/geocoding/CityAddress;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    .line 43
    .end local v2           #inputStream:Ljava/io/InputStream;
    :cond_0
    :goto_0
    return-object v0

    .line 40
    :catch_0
    move-exception v4

    move-object v1, v4

    .line 41
    .local v1, e:Ljava/lang/Exception;
    const-string v4, "getAddressFromLocation Exception"

    invoke-virtual {v1}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v5

    invoke-static {v4, v5}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0
.end method

.method public static getCodingURL(DD)Ljava/lang/String;
    .locals 3
    .parameter "latitude"
    .parameter "longitude"

    .prologue
    .line 52
    new-instance v0, Ljava/lang/StringBuffer;

    invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V

    .line 53
    .local v0, url:Ljava/lang/StringBuffer;
    const-string v1, "http://ditu.google.com/maps/geo?"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    const-string v2, "q="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    invoke-virtual {v1, p0, p1}, Ljava/lang/StringBuffer;->append(D)Ljava/lang/StringBuffer;

    move-result-object v1

    .line 54
    const-string v2, ","

    .line 53
    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    .line 54
    invoke-virtual {v1, p2, p3}, Ljava/lang/StringBuffer;->append(D)Ljava/lang/StringBuffer;

    move-result-object v1

    const-string v2, "&output=xml"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    .line 55
    const-string v2, "&oe=utf8"

    .line 54
    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    .line 55
    const-string v2, "&hl=zh-CN"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    const-string v2, "&sensor=true"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    .line 56
    const-string v2, "&key="

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    move-result-object v1

    const-string v2, "ABQIAAAAdsBVZzDdGWjGTv_i6xi2lBSqwauxr2-99EJe1WoibE7PH44ybxSxb37RQERqDgfV1tED11pngApEJQ"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 57
    invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v1

    return-object v1
.end method
